<?php
defined('BY_JYA') or exit('error');
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
$return=array();
if($_RQ['op']=='list'){
	//搜索
	$params=array('uniacid'=>$_SESSION['uniacid']);
	if($_RQ['msg']){
		$params['msg like']='%'.trim($_RQ['msg']).'%';
		$return['params']['msg']=$_RQ['msg'];
	}
	$pindex = max(1, intval($_RQ['page']));
	if($_RQ['num']){
		$psize = $_RQ['num'];
	}else{
		$psize = 15;
	}
	$total='';
	$parameter=array(
		'params'=>$params,
		'fields'=>$fields,
		'limit'=>array($pindex,$psize),
	);
	$list=pdo_getslice('jy_weishop_baobei_log',$params,array($pindex,$psize),$total,$fields,'','id desc');
	$return['list']=$list?$list:array();
	$totalpage=ceil($total/$psize);
	$totalpage=intval($totalpage);
	$return['totalpage'] =$totalpage;
	$return['params']['page'] =$pindex;
	$htmls=array(
		'type'=>'list',
		'list'=>array('data'=>'list','edit'=>false,'list'=>array(
			array('name'=>'order_id','title'=>'订单ID','type'=>'string'),
			array('name'=>'oldstatus','title'=>'原订单状态','type'=>'radio','options'=>'oldstatus'),
			array('name'=>'msg','title'=>'异常描述','type'=>'string'),
			array('name'=>'status','title'=>'异常处理状态','type'=>'radio','options'=>'status'),
		)),
		'search_one'=>array('name'=>'msg'),
	);
	$return['oldstatus']=$this->order_status;
	$return['status']=array('待处理','已处理');
	$return['htmls']=$htmls;
	exi($return);
}
if($_RQ['op'] == 'del'){
	$id=intval($_RQ['id']);
	if($id){
		pdo_delete('jy_weishop_baobei_log',array('id'=>$id,'uniacid'=>$_SESSION['uniacid']));
	}
	$del=trim($_RQ['del'],';');
	if($del){
		$del=explode(';',$del);
		foreach($del as $id){
			$id=intval($id);
			if($id){
				pdo_delete('jy_weishop_baobei_log',array('id'=>$id,'uniacid'=>$_SESSION['uniacid']));
			}
		}
	}
	exi('删除成功！');
}

?>